
// ECharts绘制对象
var option = null;

//颜色
const color = ["#0066FF", "#00CC33", "#660099", "#FF6633", "#FFCC33", "#6600FF"];

/**
 * 封装数据
 */
function getOption(dataJson, clusterNum) {
    // 样例值
    var res = [
        [
            [112.1000, 32.60335],[112.1169, 32.7076],
            [112.1369, 32.7076],[112.11888, 32.5626],
            [112.11888, 32.6726],[112.0409, 32.7434]
        ],
        [
            [112.2000, 32.60335],[112.1169, 32.5076],
            [112.1369, 32.8076],[112.13088, 32.5626],
            [112.21888, 32.6726],[112.0409, 32.6434]
        ]
    ];

    if(dataJson !== null && dataJson !== undefined) {
        res = [];
        res = JSON.parse(dataJson);
    }

    option = {
        baseOption: {
            bmap: bmap,

            geo: {
                map: 'bmap',
                roam:true
            },
            series:function(){
                var series1 = [];
                // 最多不超过6个
                if(clusterNum > 5) {
                    return [];
                }
                for( var i = 0; i < clusterNum; i++){
                    var item={
                        type: 'scatter',
                        coordinateSystem: 'bmap',
                        data: res[i],
                        itemStyle: {
                            normal: {
                                color: color[i]
                            }
                        }
                    };
                    series1.push(item);
                }
                return series1;
            }()

        }
    };

    return this.option;
}
